/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jakarta.servlet;

/**
 * Defines the permitted options for configuring the session tracking mode.
 *
 * @since Servlet 3.0
 */
public enum SessionTrackingMode {
    /**
     * Use HTTP cookies.
     * 通过HTTP Cookie追踪会话是最常用的会话追踪机制，而且Servlet规范也要求所有Servlet容器实现均需要支持Cookie追踪。
     * 当首次发起HTTP请求时，Servlet容器会发送一个用于会话的Cookie(会话标识)到客户端，在后续的请求中，客户端会将该Cookie返回到服务端，
     * 服务端根据该Cookie确定请求会话。默认情况下，Cookie的名称为JSESSIONID,可以通过<Context>的sessionCookieName属性或者<cookie-config>的name属性修改，
     * 前者优先级更高
     */
    COOKIE,

    /**
     * Use url rewriting (also known as path parameter)
     * URL重写是最基本的会话追踪机制。当客户端不支持Cookie时，可以采用URL重写的方式。当采用URL追踪模式时，请求路径需要包含会话标识信息，
     * Servlet容器会根据路径中的会话标识设置请求的会话信息。Servlet规范要求会话标识必须为URL路径参数，参数名为jsessionid,
     * 如http:/www.myserver.com/catalog/index.html;jsessionid--l234。 URL重写会将会话标识暴露到日志、书签、HTTP referer头信息、缓存的HTML页面、浏览器URL条等，
     * 因此如果可以使用Cookie或者SSL会话，尽量不要使用URL重写。
     */
    URL,

    /**
     * Use SSL session.
     * 对于SSL请求，通过SSL会话标识确定请求会话标识
     */
    SSL
}
